<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box{
            border: 1px solid black;
            margin: 4px ;
            padding: 10px;
        }
    </style>
</head>
<body>
    <div id="app">
        <h5>父组件</h5>
        <p>msg:{{ msg }}</p>
        <p>info:{{ info }}</p>
        <my-comp v-model="msg" v-bind:info.sync="info"></my-comp>
        
    </div>
    <script type="text/x-template" id="mycomp">
         <div class="cbox">
            <input v-model="argA" type="text" />
            <br>
            <input v-model="argB" type="text" />
        </div>
    </script>
    <script type="module">
        import Vue from "/assets/vue2/vue.esm.browser.js";
        const MyComp={
            template:'#mycomp',
            model:{
                prop:"msg",
                event:"update:msg"
            },
            props:["msg","info"],
            computed:{
                argA:{
                    get(){
                        return this.msg
                    },
                    set(nv){
                        this.$emit("update:msg",nv)
                    }
                },
                argB:{
                    get(){
                        return this.info
                    },
                    set(nv){
                        this.$emit("update:info", nv)
                    }
                }
            }
        }
        new Vue({
            el:'#app',
            data() {
                return {
                       msg: "msg变量",
                    info: "info变量"
                }
            },
             components: {
                MyComp,
            },
        })
    </script>
</body>
</html>